package com.github.maojx0630.onebot.dto.send.msg;

import com.github.maojx0630.onebot.dto.send.Send;
import lombok.Data;

@Data
public class SendLocation implements Send {

  private String lat;

  private String lng;

  private String name;

  private String address;

  private SendLocation(String lat, String lng, String name, String address) {
    this.lat = lat;
    this.lng = lng;
    this.name = name;
    this.address = address;
  }

  public static SendLocation of(String lat, String lng, String name, String address) {
    return new SendLocation(lat, lng, name, address);
  }


  @Override
  public String getKey() {
    return "data";
  }

  @Override
  public String getType() {
    return "json";
  }

  @Override
  public String getValue() {
    String json = "{\"app\":\"com.tencent.map\",\"desc\":\"\",\"from\":1,\"meta\":{\"Location.Search\":{\"address\":\"%s\",\"lat\":\"%s\",\"lng\":\"%s\",\"name\":\"%s\"}},\"prompt\":\"[位置]%s\",\"ver\":\"1.1.2.21\",\"view\":\"LocationShare\"}";
    return String.format(json, address, lat, lng, name, name);
  }
}
